<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" xmlns:v-on="http://www.w3.org/1999/xhtml">

	<head>

		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">

		<!--/*@thymesVar id="application" type="javax.servlet.ServletContext"*/-->
		<title th:text="${application.sites_title}">登录</title>
		<meta name="keywords" content="">
		<meta name="description" content="">

		<link rel="shortcut icon" href="../../../static/favicon.ico" th:href="@{/favicon.ico}">

		<link rel="stylesheet" type="text/css" href="../../../static/bootstrap/css/bootstrap.min.css" th:href="@{/bootstrap/css/bootstrap.min.css}" />
		<link rel="stylesheet" type="text/css" href="../../../static/plugins/layui/css/layui.css" th:href="@{/plugins/layui/css/layui.css}" />
		<link rel="stylesheet" type="text/css" href="../../../static/web/admin/css/font-awesome.css" th:href="@{/web/admin/css/font-awesome.css}" />
		<link rel="stylesheet" type="text/css" href="../../../static/web/admin/css/animate.css" th:href="@{/web/admin/css/animate.css}" />
		<link rel="stylesheet" type="text/css" href="../../../static/web/admin/css/style.css" th:href="@{/web/admin/css/style.css}" />

		<!--[if lt IE 9]>
    <meta http-equiv="refresh" content="0;ie.html" />
    <![endif]-->
		<script>
			if(window.top !== window.self) {
				window.top.location = window.location;
			}
		</script>
	</head>

	<body class="gray-bg">

		<div class="middle-box text-center loginscreen  animated fadeInDown">
            <div>

                <h1 class="logo-name">DSer</h1>

            </div>
            <!--/*@thymesVar id="application" type="javax.servlet.ServletContext"*/-->
            <h3 th:text="${ '欢迎使用' + application.sites_title}">欢迎使用 小K服务</h3>

            <form class="m-t" role="form" action="">
                <div class="form-group">
                    <input v-model.trim="admin.username" type="text" class="form-control" placeholder="用户名">
                </div>
                <div class="form-group">
                    <input v-model.trim="admin.password" type="password" class="form-control" placeholder="密码">
                </div>
                <input type="button" v-on:click="login" class="btn btn-primary block full-width m-b" value="登 录" />

                <!--<p class="text-muted text-center">
                    <a href="#"><small>忘记密码了？</small></a> |
                    <a href="#">注册一个新账号</a>
                </p>-->

            </form>
		</div>

		<script src="../../../static/plugins/jquery.min.js" th:src="@{/plugins/jquery.min.js}" type="text/javascript" charset="utf-8"></script>
		<script src="../../../static/bootstrap/js/bootstrap.min.js" th:src="@{/bootstrap/js/bootstrap.min.js}" type="text/javascript" charset="utf-8"></script>
		<script src="../../../static/plugins/vuejs/vue.min.js" th:src="@{/plugins/vuejs/vue.min.js}" type="text/javascript" charset="utf-8"></script>
		<script src="../../../static/plugins/layui/layui.js" th:src="@{/plugins/layui/layui.js}" type="text/javascript" charset="utf-8"></script>

		<script type="text/javascript">

            layui.use(['layer'], function(){
                var app = new Vue({
                    el: '.middle-box',
                    data: {
                        admin:{
                            username: "",
                            password: ""
                        }
                    },
                    methods: {
                        login: function() {
                            if(this.admin.username.length === 0) {
                                layui.layer.msg("用户名不能为空");
                                return false;
                            }
                            if(this.admin.password.length === 0) {
                                layui.layer.msg("密码不能为空");
                                return false;
                            }
                            var index = layui.layer.load(0, {shade: false});
                            $.ajax({
                                type:"post",
                                data:this.admin,
                                url:"",
                                async:true,
                                dataType:"json",
                                success:function(data){
                                    layui.layer.close(index);
                                    layui.layer.msg(data.msg);
                                    if(data.code === 0){
                                        window.location.href="./admin/index";
                                    }
                                },
                                error:function(){
                                    layui.layer.msg("加载错误");
                                }
                            });
                        }
                    }
                })
            });
		</script>
	</body>

</html>